﻿using System;
using System.Collections.Generic;

namespace NmbpProject2.DboClasses
{
    public class Competition
    {
        public string Name { get; set; }
        public DateTime Date { get; set; }
        public List<Category> Categories { get; set; }
        public List<CompApplication> Applications { get; set; }
        public List<ProgLanguage> ProgLanguages { get; set; }

        public Competition(
            string name,
            DateTime date,
            List<Category> categories,
            List<ProgLanguage> progLanguages
            )
        {
            Name = name;
            Date = date;
            Categories = categories;
            Applications = new List<CompApplication>();
            ProgLanguages = progLanguages;
        }

        public void addApplication(CompApplication application)
        {
            application.Competition = this;
            Applications.Add(application);
        }

        public void removeApplication(CompApplication application)
        {
            Applications.Remove(application);
        }

        public override string ToString()
        {
            return String.Concat(Name, " / ", Date.Date.ToString("dd.MM.yyyy"));
        }
    }
}